package com.guoli.sms.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.guoli.sms.dao.ISysuserDao;
import com.guoli.sms.vo.Sysuser;

public class SysuserDaoImpl implements ISysuserDao {

	@Override
	public Sysuser getSysuserByNP(String name, String password, Connection conn) throws SQLException {
		String sql = "select id from t_b_sysuser where s_name=? and s_password=?";
		PreparedStatement pstmt = conn.prepareStatement(sql);
		pstmt.setString(1, name);
		pstmt.setString(2, password);
		ResultSet rs = pstmt.executeQuery();
		Sysuser sysuser = null;
		if(rs.next()){
			sysuser = new Sysuser();
			sysuser.setId(rs.getInt(1));
			sysuser.setS_name(name);
			sysuser.setS_password(password);
		}
		return sysuser;
	}

}
